﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Manage_Appraise : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                string tid = Request.Params["tid"];
                CmsDataContext db = new CmsDataContext();
                Train train = (from aT in db.Train
                                     where aT.ID == tid
                                     select aT).First();

                Rank.SelectedValue = train.Rank;
                Memo.Text = train.Remark;
            }
            catch
            {
            }
        }
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        CmsDataContext db = new CmsDataContext();

        try
        {
            string tid = Request.Params["tid"];
            Train train = (from aT in db.Train
                           where aT.ID == tid
                           select aT).First();

            train.Rank = Rank.SelectedValue;
            train.Remark = Memo.Text.Trim();

            db.SubmitChanges();

            MessageBox.Message = "已经成功保存教师考评信息。";
            MessageBox.Location = "./Appraise.aspx?tid=" + tid;
        }
        catch (Exception ee)
        {
            MessageBox.Message = ee.Message;
        }
    }
}